package cn.iocoder.yudao.module.member.dal.mysql.companyAccessCount;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.companyAccessCount.CompanyAccessCountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.companyAccessCount.vo.*;

/**
 * 访问记录 Mapper
 *
 * @author 周枫皓
 */
@Mapper
public interface CompanyAccessCountMapper extends BaseMapperX<CompanyAccessCountDO> {

    default PageResult<CompanyAccessCountDO> selectPage(CompanyAccessCountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CompanyAccessCountDO>()
                .eqIfPresent(CompanyAccessCountDO::getCompanyId, reqVO.getCompanyId())
                .eqIfPresent(CompanyAccessCountDO::getDateId, reqVO.getDateId())
                .eqIfPresent(CompanyAccessCountDO::getAccessType, reqVO.getAccessType())
                .eqIfPresent(CompanyAccessCountDO::getAccessCount, reqVO.getAccessCount())
                .orderByDesc(CompanyAccessCountDO::getId));
    }

    default List<CompanyAccessCountDO> selectList(CompanyAccessCountExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CompanyAccessCountDO>()
                .eqIfPresent(CompanyAccessCountDO::getCompanyId, reqVO.getCompanyId())
                .eqIfPresent(CompanyAccessCountDO::getDateId, reqVO.getDateId())
                .eqIfPresent(CompanyAccessCountDO::getAccessType, reqVO.getAccessType())
                .eqIfPresent(CompanyAccessCountDO::getAccessCount, reqVO.getAccessCount())
                .orderByDesc(CompanyAccessCountDO::getId));
    }

    default CompanyAccessCountDO selectByParam(CompanyAccessCountUpdateReqVO reqVO) {
        return selectOne(new LambdaQueryWrapperX<CompanyAccessCountDO>()
                .eqIfPresent(CompanyAccessCountDO::getCompanyId, reqVO.getCompanyId())
                .eqIfPresent(CompanyAccessCountDO::getDateId, reqVO.getDateId())
                .eqIfPresent(CompanyAccessCountDO::getAccessType, reqVO.getAccessType())
                .eqIfPresent(CompanyAccessCountDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(CompanyAccessCountDO::getId));
    }


}
